//
//  MenuViewController.m
//  Drawer
//
//  Created by 向祖华 on 16/4/23.
//  Copyright © 2016年 向祖华. All rights reserved.
//

#import "MenuViewController.h"
#import "ReaderViewController.h"
#import "MusicViewController.h"
#import "AppDelegate.h"

@interface MenuViewController ()

@end

@implementation MenuViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor yellowColor];
    //添加两个Button
    UIButton * readerButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [readerButton setFrame:CGRectMake(100, 100, 100, 40)];
    [readerButton setTitle:@"阅读" forState:(UIControlStateNormal)];
    [readerButton addTarget:self action:@selector(readAction) forControlEvents:(UIControlEventTouchUpInside)];
    readerButton.backgroundColor = [UIColor cyanColor];
    [self.view addSubview:readerButton];
    
    UIButton * musicButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [musicButton setFrame:CGRectMake(100, 250, 100, 40)];
    [musicButton setTitle:@"音乐" forState:(UIControlStateNormal)];
    [musicButton addTarget:self action:@selector(musicAction) forControlEvents:(UIControlEventTouchUpInside)];
    musicButton.backgroundColor = [UIColor cyanColor];
    [self.view addSubview:musicButton];
}

-(void)readAction{
    UINavigationController * readVC_na = [[UINavigationController alloc] initWithRootViewController:[ReaderViewController new]];
    AppDelegate * app = [UIApplication sharedApplication].delegate;
    [app.draw setRootViewController:readVC_na];
}

-(void)musicAction{
    UINavigationController * musicVC_na = [[UINavigationController alloc] initWithRootViewController:[MusicViewController new]];
    AppDelegate * app = [UIApplication sharedApplication].delegate;
    [app.draw setRootViewController:musicVC_na];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
